import 'package:flutter/material.dart';

import '../intl_widget.dart';

class Test_constrains extends StatelessWidget {
  const Test_constrains({super.key});

  // 因为任何时候子组件都必须先遵守父组件的约束
  @override
  Widget build(BuildContext context) {
    Widget redBox = DecoratedBox(
      decoration: BoxDecoration(color: Colors.red),
    );
    return Scaffold(
        appBar: AppBar(title: Text('Test_constains')),
        body: ConstrainedBox(
          constraints: BoxConstraints(
              minWidth: double.infinity, //宽度尽可能大
              minHeight: 50.0 //最小高度为50像素
          ),
          child: Container(
            height: 50.0,
            child: redBox ,
          ),
        ),
);
  }
}
